import Vue from "vue"

import VueRouter from "vue-router"

import Home from "../pages/Home"
import Login from "../pages/Login"
import Music from "../pages/Home/Music"
import News from "../pages/Home/News"
import Games from "../pages/Home/Games"

Vue.use(VueRouter)

export default new VueRouter({
  routes: [
    {
      path: "/login",
      component: Login,
      name: "login"
    },
    {
      path: "/home",
      component: Home,
      children: [
        {
          path: "music/:id/:time?",
          component: Music,
          name: "music",
          props: true
        },
        {
          path: "news",
          component: News,
          name: "news"
        },
        {
          path: "game",
          component: Games,
          name: "game",
          props: (route) => {
            return route.query
          }
        },
        {
          path: "",
          redirect: "/home/news"
        },
      ]
    },
    { path: "/", redirect: "/home" },
  ]
})